package org.niux.aims.common.servlet;

import java.util.Timer;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.niux.aims.common.util.SpringUtil;
import org.niux.aims.common.web.KeepDBConnectionTimer;
import org.niux.aims.dao.ILogsDAO;

public class KeepDBConnection extends HttpServlet {
    /**
	 * 
	 */
	private static final long serialVersionUID = -7583794325214054291L;

	@Override
    public void init() throws ServletException {
        super.init();
        Timer timer = new Timer();
        SpringUtil.setServletContext(this.getServletContext());
        ILogsDAO logsDao = (ILogsDAO) SpringUtil.getBean("logsDao");
        timer.schedule(KeepDBConnectionTimer.getKeepDBConnectionTimer(logsDao), 1000,1000*60*60);// 1小时发一条语句
    }
}